home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15569 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  81 lines

  1. Path: jupiter.planet.net!usenet
  2. From: cygnusx@planet.net (David)
  3. Newsgroups: comp.lang.c
  4. Subject: HELP- PASSING STRUCTURE IN FUNCTION PROTOTYPE?
  5. Date: Sat, 20 Apr 1996 02:55:39 GMT
  6. Organization: Planet Access Networks - Stanhope, NJ
  7. Message-ID: <31784e1f.4961188@news.planet.net>
  8. NNTP-Posting-Host: newt13.planet.net
  9. X-Newsreader: Forte Agent .99d/32.182
  10.  
  11.  
  12. I have this pretty simple program that accepts a first name, last name
  13. and salary using a structure type called  (employee)  The data is
  14. input into an array called  (data)  which I kept small for the time
  15. being. I want to pass it to a function called  (morethan) which then
  16. determines which persons exceed the the salary cap I have declared and
  17. print out there names. 
  18.  
  19. When I try to compile I get only one error. It is at the beginning of
  20. the function prototype  (morethan) and this is the error statment?? .
  21.  
  22.                          [  )  expected  ] .
  23.  
  24. Is this somthing with the way I wrote the program or just something in
  25. this line? I am not sure this is a good way to go about this program .
  26.  
  27. thanx    code below.................   David
  28.  
  29. #include<stdio.h>
  30.  
  31. struct employee {
  32.  
  33.     char first[10];
  34.     char last [10];
  35.     float salary;
  36.  
  37.     };
  38.  
  39. morethan(struct employee,float);
  40.  
  41. main(){
  42.  
  43.  int ctr;
  44.  struct employee data[4];
  45.  
  46.   
  47.     for (ctr=0;ctr<4;ctr++)
  48.  
  49.        {printf("please enter first name:\n");
  50.  
  51.      gets(data[ctr].first);
  52.      puts("what is the last name:\n");
  53.      gets(data[ctr].last);
  54.      puts("what is the salary:\n");
  55.      scanf("%f",&data[ctr].salary);
  56.      getchar();}
  57.  
  58.    for (ctr=0;ctr<4;ctr++)
  59.  
  60.      {printf("%s\n",data[ctr].first);
  61.      printf("%s\n",data[ctr].last);
  62.      printf("%f\n",data[ctr].salary);}
  63.  
  64.   morethan(data[4],1000);
  65.  
  66.  
  67.   return 0;}
  68.  
  69.  
  70.   morethan (struct employee a[],b)      /*  error is on this line  */
  71.  
  72.  
  73.  { for(i=0;i<4;i++)
  74.  
  75.  
  76.        if(data[i].salary > b)
  77.  
  78.          printf("%s",data[i].first);
  79.          printf("%s",data[i].last);}
  80.  
  81.